package com.mstore.dao;

import java.util.List;

import com.mstore.pojo.BalanceOrderInfo;


public class BalanceOrderInfoDao extends SuperDao {

	/**
	 * 新增
	 */
	public void addBalanceOrderInfo(BalanceOrderInfo balanceOrderInfo) {
		save(balanceOrderInfo);
	}
	
	/**
	 * 修改状态
	 */
	public void updateForState(String orderId) {
		String sql = "update ubcenter.c_balance_order_info set state = 1 where order_id = '" + orderId + "'";
		executeUpdate(sql);
	}
	
	/**
	 * 通过orderId查询
	 */
	public Object getBalanceOrderInfoByOrderId(String orderId) {
		String sql = "from BalanceOrderInfo where orderId = ?";
		List<Object> objs = getObject(sql, new Object[] { orderId });
		if (objs.isEmpty()) {
			return null;
		}
		
		return objs.get(0);
	}
	
}
